package com.loup.test;

import javafx.beans.binding.ObjectExpression;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * Created by loup on 2018/5/2.
 */
public class PersonProxy implements InvocationHandler {

    private Person target;

    public Object getInstance(Person person){
        this.target = person;
        return Proxy.newProxyInstance(person.getClass().getClassLoader(),person.getClass().getInterfaces(),this);
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        method.invoke(target,null);
        return null;
    }
}
